This is what you do when raytracing: for every point on the DM grid, you trace a line from the camera outwards and see where it intersects with some piece of 3D geometry. 
The situation is like this: 

	--------------------------------------------------------------------------------
	        _-
	      _-|
	    _-  |   /\
	eye*_...|..x obj )  x = intersection
	     -_ |   \___/
	       -|
	        -
	        ^
	    projection
	      plane
	--------------------------------------------------------------------------------

Imagine that the DM grid is in the projection plane, with the eye behind it. By connecting the eye with every point on the DM grid, you get a viewing 'pyramid' of rays. A ray is uniquely described by its point of origin, and a vector that points in the direction of the ray. 

If the eye is at (0,0,0) and the projection plane is the plane z=1, then all the rays start at the origin, and have vector: 
(x,y,1). For most raytracing calculations such as lighting, this vector has to be normalized (length=1), but we don't need that for regular 3D DMs. 

We call the direction vector of the ray (dx,dy,dz). The origin is (ox,oy,oz). So the points on the ray can be written as (k*dx+ox, k*dy+oy, k*dz+oz) where k is a real number. To find the intersection point of the ray with an object, you fill in these coordinates in the equation of the shape, and then solve for 'k'. Then you fill in 'k' in your ray equation to get the intersection point's coordinates. 

Now, to achieve rotation, we simply rotate the viewing pyramid around the eye. This gives you realistic camera behaviour, because the objects in the world don't move, only the camera. Note that you need different order of rotations: first around the z-axis, then x-axis, then y-axis. To visualise why, follow the following movements... it's easiest if you're sitting on a rotating chair: 
- look straight forward 
- Z: tilt your head sideways (as if reading a smiley) 
- X: look up while tilted 
- Y: now rotate yourself left/right (easy on a rotating chair) 

This is the only correct way because we're rotating around the worlds X,Y,Z axes and not local X,Y,Z axes. For example if we were to first rotate left 90 (Y), the world's X would lie in front of us. 

Now we will raytrace the plane x+y = 1 

We fill in general expression for a point on the ray and isolate 'k': 

	--------------------------------------------------------------------------------
	         x    +    y     =  1
	<=>   k*dx+ox + k*dy+oy  =  1
	<=>   (dx + dy)*k        =  1 - ox - oy
	<=>             k        =  1 - ox - oy  (<----- RAZ - UNDERLINE RIGHT SIDE OF                                            dx + dy       EQUALS TO SHOW DIVISION, 13373571)
	--------------------------------------------------------------------------------

Now we have the intersection point at: 
(k*dx+ox, k*dy+oy, k*dz+oz) 

You can calculate the texture coordinates (x,y) from these. Note that, because only the camera moves, not the object, you never have to adjust your calculated coordinates.

In order to have several shapes, you can either have multiple DM's and blend them together, or if your objects are solid, you can calculate multiple k's and use some function on them (usually the smallest positive 'k').

Oh there's one thing I forgot to mention... the calculation can result in a negative 'k', which means the intersection point lies behind the camera. You should usually discard these points, unless they are what you need. 

For example, if you raytrace the plane x=1 with the camera at (0,0,0), you will get an imaginary plane x=-1. However, if the camera moves closer to the real plane, the imaginary plane will come closer too. 

	--------------------------------------------------------------------------------

	_ _ _ _ _ _ x _ _ _ _ _ _ _ _ _ _  imaginary plane
	           /
	          /
	         /
	    eye *
	       . \
	      .   \
	    _.     \_                      real plane
	xx
	
	--------------------------------------------------------------------------------

